/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package user;

import database.Bill;
import java.util.ArrayList;
import javax.swing.AbstractListModel;

/**
 *
 * @author Jack
 */
public class UserInfoPanelBillPopulate extends AbstractListModel {
    private final ArrayList<Bill> listOfBills;
    
    public UserInfoPanelBillPopulate(ArrayList<Bill> list){
        this.listOfBills=list;
    }
    
    // Return the size of the list
    @Override
    public int getSize() {
        return listOfBills.size();
    }

    // Return an element from the list
    @Override
    public Object getElementAt(int index) {
        int month=listOfBills.get(index).getMonth();
        int price=listOfBills.get(index).getPrice();
        return "Month: "+month+", Price: "+price;
    }
}
